<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>{&SITE_TITLE}</title>
  <link href="__PUBLIC__/admin/css/layout.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="__PUBLIC__/js/jquery.js" ></script>

	<script type="text/javascript">
		var ctrl = function(name){
			this.elements = document.getElementsByName('id[]');
			this.length = this.elements.length;
		}
		ctrl.prototype = {
			reverse:function(){
				for(i=0;i<this.length;i++){
					this.elements[i].checked= !this.elements[i].checked;
				}
			},
			all:function(){
				for(i=0;i<this.length;i++){
					this.elements[i].checked = true;
				}
			},
			unAll:function(){
				for(i=0;i<this.length;i++){
					this.elements[i].checked = false;
				}
			},
			toggle:function(obj){
				this[obj.checked ? 'all' : 'unAll']();
			},
			del:function(id){
				if(id==undefined){
					id = [];
					for(i=0;i<this.length;i++){
						this.elements[i].checked && id.push(this.elements[i].value);
					}
					id = id.join(',');
				}
        //ajax删除id
        $.post( '__URL__/doChangeIco',{id:id},function( text ){
            //返回1，是只是选择了一个id,返回2，选择了多个
            if( text == 1 ){
                 $( 'tr['+'id=\'biaoqing'+id+'\']' ).remove();
              }else if( text == 2 ){
                  var id_list = id.split( ',' );   
                  for (var j=0 ; j< id_list.length ; j++   ){
                      $( 'tr['+'id=\'biaoqing'+id_list[j]+'\']' ).remove();
                  }
              }else{
                alert( '删除失败' );
              }
            });
			},
			edit:function(id){
              var em=prompt("请输入文字表情",$( '#e'+id ).attr( 'emotion' ));
              if( em )//如果返回的有内容
              {
                      $( '#e'+id ).val( em );
              }
            }
		}
		var c = null;
	</script>
	</head>
	<body>
		<div id="container">
      <a href="__URL__/index/">全局设置</a>||<a href="__URL__/ico/">表情设置</a>||<a href="__URL__/minilist/">心情管理</a>
			<table class="tableborder" width="100%">
				<tbody>
					<tr class="top">
						<td class="border"></td>
					</tr>
					<tr>
						<th class="header">tips</th>
					</tr>
					<tr>
						<td class="tips">
							<ul>
								<li>数据备份功能根据您的选择备份全部论坛帖子和设置数据，导出的数据文件可用“数据恢复”功能或 phpMyAdmin 导入。</li>
								<li>数据备份选项中的设置，仅供高级用户的特殊用途使用，当您尚未对数据库做全面细致的了解之前，请使用默认参数备份，否则将导致备份数据错误等严重问题。</li>
								<li>十六进制方式可以保证备份数据的完整性，但是备份文件会占用更多的空间。</li>
								<li>压缩备份文件可以让您的备份文件占用更小的空间。</li>
							</ul>
						</td>
					</tr>
					<tr class="bottom">
						<td class="border" colspan="5">&nbsp;</td>
					</tr>
				</tbody>
			</table>
            <form action="__URL__/doAddSmile/" method="post">
			<table class="tableborder" width="100%">
				<tbody>
					<tr class="top">
						<td class="border" colspan="6"></td>
					</tr>
					<tr>
                      <th class="header" colspan="6">{$smiletype}</th>
					</tr>
					<tr class="label">
						<th><input type="checkbox" class="checkbox" onclick="c.toggle(this)" />删？</th>
						<th>文件名</th>
						<th>显示名</th>
						<th>表情</th>
                        <th>文件表情</th>
						<th>操作</th>
					</tr>
          <php>foreach( $smile_list as $vo ){</php>
          <tr class="cell altbg1" id = 'biaoqing{$key}'>
            <php>$i++</php>
            <td><input type="checkbox" class="checkbox" name="id[]" value="{$vo['id']}" /></td>
            <td>{$vo['filename']}</td>
            <td>{$vo['title']}</td>
            <td><img src="<php>echo $smilepath.$vo['filename']</php>" width ='20' height='20' /></td>
            <td ><input type='input' name="emotion[]" class="txt" id="e{$vo['id']}" emotion="{$vo['emotion']}" value="{$vo['emotion']}" /></td>
            <td><button type="button" onclick="c.del('{$key}')">删除</button></td>
					</tr>
            <input type='hidden' name='filename[]' value="{$vo['filename']}">
            <input type='hidden' name='title[]' value="{$vo['title']}">
          <php>}</php>
					<tr>
						<td class="footer" colspan="6">
							<button type="button" onclick="c.all()">全选</button>
							<button type="button" onclick="c.unAll()">全不选</button>
							<button type="button" onclick="c.reverse()">反选</button>
							<button type="button" onclick="c.del()">删除</button>
							<button type="submit" >确定</button>
						</td>
					</tr>
					<tr class="bottom">
						<td class="border" colspan="6">&nbsp;</td>
					</tr>
				</tbody>
			</table>
		</div>
        </form>
		<script type="text/javascript">
			c = new ctrl('id[]');
		</script>
	</body>
</html>
